package com.csdj.t309springboot.service;
import com.csdj.t309springboot.entity.Employee;
import com.csdj.t309springboot.entity.RespPageBean;
import com.csdj.t309springboot.mapper.EmployeeMapper;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;

import javax.annotation.Resource;
import java.util.List;
/**
 * @description:
 * @author: Leo
 * @createDate: 2020/2/1
 * @version: 1.0
 */
@Service
public class EmployeeService
{
    @Resource
    EmployeeMapper employeeMapper;

    public RespPageBean getEmpByPage(Integer page, Integer size)
    {

        if(page!=null&&size!=null){
            page=(page-1)*size;
        }
        List<Employee> data=employeeMapper.getEmpByPage(page,size);
        Long total=employeeMapper.getTotal();
        RespPageBean bean = new RespPageBean();
        bean.setData(data);
        bean.setTotal(total);
        return bean;
    }
}

